package com.zmj.sy.mom.srv.aps.feign;

import com.zmj.sy.mom.srv.aps.bean.dto.feign.Ltk.LtkCommonsResDto;
import com.zmj.sy.mom.srv.aps.bean.dto.feign.Ltk.LtkPushLoftReqDto;
import com.zmj.sy.mom.srv.aps.bean.dto.feign.Ltk.LtkSelectResDto;
import com.zmj.sy.mom.srv.aps.bean.vo.lantek.LantekPutReqVo;
import com.zmj.sy.mom.srv.aps.bean.vo.lantek.ProgramWithdrawalReqVo;
import com.zmj.sy.mom.srv.aps.bean.vo.lantek.TextureReplaceReqVo;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

import java.util.List;
import java.util.Map;

//@FeignClient(url = "http://172.31.3.120:3002", name = "lantekApiClient")
@FeignClient(url = "${project.feign.ltk-url}", name = "lantekApiClient")
public interface LantekApiClient {

    /**
     * API-001 推送零件图纸
     */
    @PostMapping("/api/0114/BasePart/RegisterOrUpdate")
    LtkCommonsResDto pushNestLofting(@RequestBody Map<String, List<LtkPushLoftReqDto>> map, @RequestHeader("Authorization") String token);

    /**
     * API-002 推送套料计划接口
     */
    @PostMapping("/api/0114/ManufacturingOrder/Creates")
    LtkCommonsResDto pushNestPlan(@RequestBody Map<String, Object> map, @RequestHeader("Authorization") String token);

    /**
     * API-003 查询零件信息
     */
    @GetMapping("/api/0114/BasePart/Page")
    LtkSelectResDto getPartInfo(@RequestParam("current") Integer current,
                                @RequestParam("size") Integer size,
                                @RequestParam("uniMaterCode") String uniMaterCode,
                                @RequestParam("materName") String materName,
                                @RequestParam("matRef") String matRef,
                                @RequestParam("thickness") Integer thickness,
                                @RequestParam("materCode") String materCode,
                                @RequestParam("factoryCode") String factoryCode,
                                @RequestParam("constructNo") String constructNo,
                                @RequestParam("productCode") String productCode,
                                @RequestHeader("Authorization") String token);

    /**
     * API-004 查询套料计划
     */
    @GetMapping("/api/0114/ManufacturingOrder/Page")
    LtkSelectResDto getPlan(@RequestParam("current") Integer current,
                            @RequestParam("size") Integer size,
                            @RequestParam("factoryCode") String factoryCode,
                            @RequestParam("planId") String planId,
                            @RequestParam("constructNo") String constructNo,
                            @RequestParam("uniMaterCode") String uniMaterCode,
                            @RequestParam("packageCode") String packageCode,
                            @RequestParam("materName") String materName,
                            @RequestHeader("Authorization") String token);

    /**
     * API-005 图纸解析零件信息
     */
    @PostMapping(value = "/api/0114/BasePart/ParseDrawing" ,produces = MediaType.APPLICATION_JSON_UTF8_VALUE, consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
//    LtkSelectResDto drawingAnalysis(@RequestBody LantekDrawingInfoReqVo lantekDrawingInfoReqVo, @RequestHeader("Authorization") String token);
    LtkSelectResDto drawingAnalysis(@RequestPart("file") MultipartFile file,
                                    @RequestPart("texture") String  texture,
                                    @RequestPart("thickness") Integer thickness,
                                    @RequestHeader("Authorization") String token);

    /**
     * API-006 图纸转换-根据DXF转换PNG
     */
    @PostMapping(value ="/api/0114/BasePart/DXF2PNG",produces = MediaType.APPLICATION_JSON_UTF8_VALUE, consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
    byte[] exchangePNG(@RequestPart("file") MultipartFile file, @RequestHeader("Authorization") String token);

    /**
     * API-007 图纸转换-根据DXF转换PDF
     */
    @PostMapping(value ="/api/0114/BasePart/DXF2PDF",produces = MediaType.APPLICATION_JSON_UTF8_VALUE, consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
    byte[] exchangePDF(@RequestPart("file") MultipartFile file, @RequestHeader("Authorization") String token);

    /**
     * API-008 删除生产订单
     */
    @DeleteMapping("/api/0114/ManufacturingOrder/Delete")
    LtkCommonsResDto deleteOrder(@RequestBody List<String> list, @RequestHeader("Authorization") String token);

    /**
     * API-009 删除零件信息
     */
    @DeleteMapping("/api/0114/BasePart/Delete")
    LtkCommonsResDto deletePartInfo(@RequestBody List<String> list, @RequestHeader("Authorization") String token);

    /**
     * API-010 修改生产订单
     */
    @PutMapping("/api/0114/ManufacturingOrder/Updates")
    LtkCommonsResDto updateOrder(@RequestBody LantekPutReqVo reqVo, @RequestHeader("Authorization") String token);

    /**
     * API-011 套料图撤回
     */
    @PostMapping("/api/0114/ManufacturingOrder/ProgramWithdrawal")
    LtkSelectResDto programWithdrawal(@RequestBody ProgramWithdrawalReqVo reqVo, @RequestHeader("Authorization") String token);

    /**
     * API-012 零件材质以高代低
     */
    @PostMapping("/api/0114/ManufacturingOrder/HighQualityReplacingLowQuality")
    LtkSelectResDto highQualityReplacingLowQuality(@RequestBody TextureReplaceReqVo reqVo, @RequestHeader("Authorization") String token);

    /**
     * 兰特克 新 对接接口
     * 板材释放接口
     */
//    @PostMapping("/0114/SteelPlate/ReleaseAPSIntegratedInventory")
//    LtkSelectResDto releaseAPSIntegratedInventory(@RequestBody PlateReleaseListReqVo reqVo, @RequestHeader("Authorization") String token);

    /**
     * 兰特克 新 对接接口
     * 订单释放接口
     */
//    @PostMapping("/0114/ManufacturingOrder/Release")
//    LtkSelectResDto release(@RequestBody OrderReleaseReqVo reqVo, @RequestHeader("Authorization") String token);

}

// 图片地址：http://172.31.3.120:15261/Products/0/1-IMGB.png
// 地址：http://172.31.3.110:3002（3002：nginx端口 9600：服务端口） 对接117环境（试运行，后续对接53）
// 地址：http://172.31.3.120:3002（3002：nginx端口 9600：服务端口） 对接43环境（测试）